package com.mi9688.method_quote;

public class Test04 {
    /**
     * 对象方法引入
     */
    public static void main(String[] args) {

        //匿名内部类
        MessageInterface3 m0 = new MessageInterface3() {
            @Override
            public int getMessageRow(Message msg) {
                return msg.lineCount();
            }
        };
        System.out.println(m0.getMessageRow(new Message()));
        //Lambda
        MessageInterface3 m = (msg) -> {
            return msg.lineCount();
        };
        System.out.println(m.getMessageRow(new Message()));

        System.out.println("----------------------");
        //对象方法引入
        MessageInterface3 m1 = Message::lineCount;
        System.out.println(m1.getMessageRow(new Message()));
    }
}
